package text;

class TestThread extends Thread {
    private int index;
    public static int count=0;
    public TestThread(String name,int index){
        super(name);
        this.index=index;
    }

    @Override
    public void run() {
        while(count<9){
            if(count%3+1==index){
                for(int i=1;i<=5;i++){
                    System.out.println(this.getName()+":"+(count*5+i));
                }
                count=count+1;
            }
        }
    }

    public static void main(String[] args) {
        TestThread t1=new TestThread("线程1", 1);
        TestThread t2=new TestThread("线程2", 2);
        TestThread t3=new TestThread("线程3", 3);
        t1.start();
        t2.start();
        t3.start();
    }
}